package rpc

import (
	"fmt"
	"go-graduation/bff/api/v1/router"
	"go-graduation/bff/cmd/cfg"
	"log"
)

type GrpcServer struct {
	port string
}

func ListenServer() {

	defer func() {
		if err := recover(); err != nil {
			fmt.Printf("err = %#v\n", err)
			return
		}
	}()

	conn := NewRpcAppEr(cfg.Conf.Host.ServiceDomain, cfg.Conf.Host.ServicePort)
	defer conn.Close()
	r := router.NewEntry(conn)
	// Run http server
	if err := r.Run(":8052"); err != nil {
		log.Fatalf("could not run server: %v", err)
	}
}
